//
//  OnlineOLTitleTableViewCell.m
//  ShangHaiHuDongApp
//
//  Created by apple on 17/9/4.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "OnlineOLTitleTableViewCell.h"

@implementation OnlineOLTitleTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initMyCell];
    }
    return self;
}

-(void)initMyCell{
    [self.contentView addSubview:self.titleImageView];
    UIButton * joinPeopleNumberButton = [[UIButton alloc]initWithFrame:CGRectMake(1, 1, 1, 1)];
    [joinPeopleNumberButton addTarget:self action:@selector(option_joinPeopleButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:joinPeopleNumberButton];
    [joinPeopleNumberButton addSubview:self.joinPeopleNumberLabel];
    joinPeopleNumberButton.sd_layout.rightSpaceToView(self.contentView , 0).bottomSpaceToView(self.contentView , ItemHeight * 16).widthIs(ItemWidth * 290).heightIs(ItemHeight * 70);
    self.joinPeopleNumberLabel.sd_layout.rightSpaceToView(joinPeopleNumberButton , ItemWidth * 30).bottomSpaceToView(joinPeopleNumberButton , ItemHeight * 15).widthIs(ItemWidth * 230).heightIs(ItemHeight * 40);
    
    UIView * bottomView = [[UIView alloc]initWithFrame:CGRectMake(1, 1, 1, 1)];
    bottomView.backgroundColor = [UIColor themeGrayColor];
    [self.contentView addSubview:bottomView];
    bottomView.sd_layout.rightSpaceToView(self.contentView , 0).bottomSpaceToView(self.contentView , 0).widthIs([UIScreen zj_screenWith]).heightIs(ItemHeight * 16);
}


-(void)option_joinPeopleButton:(UIButton *)sender{
    if (self.delegate && [self.delegate respondsToSelector:@selector(clickJoinPeopleNumberButton)]) {
        [self.delegate clickJoinPeopleNumberButton];
    }
}


-(UIImageView *)titleImageView
{
    if (!_titleImageView) {
        _titleImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen zj_screenWith], ItemHeight * 375)];
    }
    return _titleImageView;
}


-(UILabel *)joinPeopleNumberLabel
{
    if (!_joinPeopleNumberLabel) {
        _joinPeopleNumberLabel = [ToolClass creatLabelWithFrame:CGRectMake(1, 1, 1, ItemHeight * 40) font:14 textColor:[UIColor textGrayColor] text:@""];
        _joinPeopleNumberLabel.textAlignment = NSTextAlignmentCenter;
        _joinPeopleNumberLabel.clipsToBounds = YES;
        _joinPeopleNumberLabel.layer.cornerRadius = ItemHeight * 20;
        _joinPeopleNumberLabel.backgroundColor = [UIColor whiteColor];
    }
    return _joinPeopleNumberLabel;
}

@end
